import {request} from './request';

//收到订单
export function getOders() {
    return request({
        url:'/api/orders/preview'
    })
}

//创建订单
export function createOrder(params) {
    return request({
        url:'/api/orders',
        method:'post',
        params
    })
}

//订单支付,获取二维码
export function payOrder(order,params) {
    return request({
        url:`/api/orders/${order}/pay`,
        method:'get',
        params
    })
}

//查询订单状态
export function payOrderStatus(order) {
    return request({
        url:`/api/orders/${order}/status`,
        method:'get',
    })
}

//获取用户订单列表{page:1, status:2, include:'user,orderDetail.goods'}
export function getOrderList(params) {
    return request({
        url:'/api/orders',
        method:'get',
        params
    })
}

//订单详情
export function getOrderDetail(order) {
    return request({
        url:`/api/orders/${order}`,
        params:{
            include:'user,orderDetails.goods'
        }
    })
}

//确认订单收货
export function confirmOrder(order) {
    return request({
        url:`/api/orders/${order}/confirm`,
        method:'patch',
    })
}

//查看物流
export function viewExpress(order) {
    return request({
        url:`/api/orders/${order}/express`,
    })
}